home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_iiset.inc < prev    next >
Encoding:
Text File  |  1998-11-12  |  10.3 KB  |  322 lines

  1. <% 
  2.  
  3. dim quote,isAdmin,disabletextstart,disableintstart,disabletextend
  4. dim bUpdateGlobal
  5.  
  6. bUpdateGlobal = true
  7.  
  8. quote=chr(34)
  9.  
  10. disabletextstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=300>"
  11. disableintstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=75>"
  12. disabletextend="</TD></TR></TABLE>"
  13.  
  14. isAdmin=Session("isAdmin")
  15.  
  16. function checkboxmask(fieldname, fieldmask, onclickproc, adminonly)
  17.     On Error Resume Next 
  18.     Dim val
  19.     
  20.     if mid(fieldname,1,1)="!" then
  21.         fieldname=mid(fieldname,2) 
  22.         val=not (currentobj.Get(fieldname) and fieldmask)
  23.     else
  24.         val=(currentobj.Get(fieldname) and fieldmask)
  25.     end if
  26.  
  27.     checkboxmask = writeCheckboxVal(err, val, fieldname, fieldmask, onclickproc, adminonly)
  28. end function
  29.  
  30. function checkbox(fieldname, onclickproc, adminonly)
  31.     On Error Resume Next 
  32.     Dim val
  33.  
  34.     if mid(fieldname,1,1)="!" then
  35.         fieldname=mid(fieldname,2) 
  36.         val=not currentobj.Get(fieldname)
  37.     else
  38.         val=currentobj.Get(fieldname)
  39.     end if
  40.     
  41.     checkbox = checkboxVal(err,val,"chk" & fieldname,onclickproc,adminonly)
  42.  
  43. end function
  44.  
  45. function checkboxVal(err, val, fieldname, onclickproc, adminonly)
  46.     On Error Resume Next 
  47.     checkboxVal = writeCheckboxVal(err, val, fieldname, "", onclickproc, adminonly)
  48. end function
  49.  
  50. function writeCheckboxVal(err, val, fieldname,fieldmask, onclickproc, adminonly)
  51.     On Error Resume Next 
  52.     Dim outputStr
  53.  
  54.     if err <> 0 then
  55.         outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX'>"
  56.         alertuser fieldname    
  57.     else
  58.         if (not adminonly) or isAdmin then
  59.             if val then
  60.                 outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED"
  61.             else
  62.                 outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' "
  63.             end if
  64.             
  65.             if fieldmask <> "" then                
  66.                 outputStr = outputStr & " VALUE=" & fieldmask 
  67.             end if
  68.                         
  69.             outputStr = outputStr & " OnClick=" & quote
  70.             if bUpdateGlobal then
  71.                 outputStr = outputStr & "top.title.Global.updated=true;"
  72.             end if
  73.  
  74.             if onclickproc <> "" then                
  75.                 outputStr = outputStr & onclickproc & quote & ">"
  76.             else
  77.                 outputStr = outputStr & quote & ">"
  78.             end if
  79.         else
  80.             if Session("hasDHTML") then
  81.                 if val then
  82.                     outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  83.                 else
  84.                     outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  85.                 end if                
  86.             else
  87.                 
  88.                 if val then
  89.                     outputStr="<IMG ALIGN=middle SRC=" & quote & "images/checkon.gif" & quote & ">"
  90.                 else
  91.                     outputStr="<IMG ALIGN=middle SRC=" & quote & "images/checkoff.gif" & quote & ">"
  92.                 end if
  93.             end if
  94.         end if 
  95.     end if
  96.     writeCheckboxVal = outputStr    
  97. end function
  98.  
  99.  
  100. function printoption(selected, text, adminonly)
  101.     'On Error Resume Next 
  102.     if selected then
  103.         printoption="<OPTION SELECTED>" & text
  104.     else
  105.         if (isadmin or not adminonly) then            
  106.             printoption="<OPTION>" & text
  107.         end if
  108.     end if
  109.  
  110. end function
  111.  
  112.  
  113.  
  114. function getoption(fieldname,value, adminonly)
  115.     'On Error Resume Next 
  116.     Dim val
  117.     val=currentobj.Get(fieldname)
  118.     if err <> 0 then
  119.         val = False
  120.         alertuser fieldname            
  121.     end if
  122.     getoption = printoption((value=val),value,adminonly)
  123. end function
  124.  
  125.  
  126. function radio(fieldname,value, onclickproc, adminonly)
  127.     On Error Resume Next 
  128.     Dim val
  129.     val=currentobj.Get(fieldname)
  130.     if err <> 0 then
  131.         radio=(printradio(fieldname, False,onclickproc,adminonly)) 
  132.         alertuser "rdo" & fieldname    
  133.     else
  134.             if (typename(val)="Boolean") then
  135.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)        
  136.             else
  137.                 if mid(value,1,1)="!" then
  138.                     output=printradio(fieldname, (val <> mid(value,2)),onclickproc,adminonly)        
  139.                 else
  140.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)
  141.                 end if
  142.             end if 
  143.         radio=output
  144.     end if
  145. end function
  146.  
  147. function printradio(fieldname, checked, onclickproc,adminonly)
  148.     Dim output, chkstr
  149.     
  150.     if checked then
  151.         chkstr="CHECKED"
  152.     else
  153.         chkstr=""
  154.     end if 
  155.     
  156.     if ((not adminonly) or isAdmin) then
  157.         output="<INPUT NAME=" & quote & "rdo" & fieldname & quote & " TYPE=" & quote & "RADIO" & quote & " " & chkstr
  158.         output=output & " OnClick=" & quote
  159.  
  160.         if bUpdateGlobal then
  161.             output = output & "top.title.Global.updated=true;"
  162.         end if
  163.         
  164.         if onclickproc <> "" then
  165.             printradio=output & onclickproc & quote & ">"
  166.         else
  167.             printradio=output & quote & ">"
  168.         end if
  169.     else
  170.         if checked then
  171.             printradio="<IMG SRC=" & quote & "images/radioon.gif" & quote & ">"
  172.         else
  173.             printradio="<IMG SRC=" & quote & "images/radiooff.gif" & quote & ">"
  174.         end if
  175.     end if 
  176.  
  177. end function
  178.  
  179. function text(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  180.     On Error Resume Next 
  181.     Dim val
  182.     val=currentobj.Get(fieldname)
  183.     text=inputbox(err,"text",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  184. end function
  185.  
  186. function pword(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  187.     On Error Resume Next 
  188.     Dim val
  189.     val=currentobj.Get(fieldname)
  190.     if ((not adminonly) or isAdmin) then
  191.         pword=inputbox(err,"password",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  192.     else
  193.         pword=disabletextstart & "*******" & disabletextend
  194.     end if
  195.     
  196. end function
  197.  
  198. function writehidden(fieldname)
  199.     On Error Resume Next 
  200.     writehidden=inputbox(0,"hidden",fieldname,currentobj.Get(fieldname),"","","","",false,false,false)
  201. end function
  202.  
  203. function inputbox(err,fieldtype,fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  204.     inputbox = writeinputbox(err,fieldtype,fieldname,val,fieldsize,"",onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,false) 
  205. end function
  206.  
  207. function inputboxfixed(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  208.     inputboxfixed = writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,false) 
  209. end function
  210.  
  211. function disabledbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
  212.     disabledbox = writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false,true)
  213. end function
  214.  
  215. function writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,disabled)
  216.     On Error Resume Next 
  217.     Dim textstr
  218.     if err <> 0 then
  219.         textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & ">"
  220.         alertuser fieldname    
  221.     else
  222.         if ((not adminonly) or isAdmin) then
  223.             textstr="<INPUT TYPE=" & quote & fieldtype & quote
  224.             textstr=textstr & " NAME=" & quote & fieldname & quote
  225.             if fieldsize <> "" then
  226.                 textstr = textstr & " SIZE = " & (Session("BrowserTBScalePct") * fieldsize/100)
  227.             else
  228.             end if 
  229.             if maxfieldsize <> "" then
  230.                 textstr=textstr & " MAXLENGTH=" & maxfieldsize
  231.             else
  232.             end if             
  233.             textstr=textstr & " VALUE=" &  quote & val & quote
  234.             textstr=textstr & " OnChange=" & quote
  235.             
  236.             if bUpdateGlobal then
  237.                 textstr = textstr & "top.title.Global.updated=true;"
  238.             end if
  239.             
  240.             if onchangeproc <> "" then
  241.                 textstr=textstr & onchangeproc & quote
  242.             else
  243.                 textstr=textstr & quote
  244.             end if
  245.             if onfocusproc <> "" then
  246.                 textstr=textstr & " OnFocus=" & quote & onfocusproc & quote
  247.             end if
  248.             if onblurproc <> "" then
  249.                 textstr=textstr & " OnBlur=" & quote & onblurproc & quote
  250.             end if            
  251.             if readonly then
  252.                 textstr=textstr & " READONLY"
  253.             end if
  254.             if disabled then
  255.                 textstr=textstr & " DISABLED"
  256.             end if
  257.             if Session("hasStyles") then 
  258.                 textstr=textstr & Session("DEFINPUTSTYLE")
  259.             end if 
  260.             textstr=textstr & ">"            
  261.             if hidden then
  262.                 textstr=textstr & " <INPUT TYPE=" & quote & "hidden" & quote & " NAME=" & quote & "hdn" & fieldname & quote & " VALUE=" &  quote & val & quote & ">"
  263.             end if            
  264.         else    
  265.         
  266.             if Session("hasDHTML") then
  267.                     textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & " VALUE='" & val & "' DISABLED FACE=" & quote & Session("FONTFACE") & quote & ">"
  268.             else
  269.                 if val = "" then
  270.                     val  = " "
  271.                 else
  272.                     if len(val) > 50 then
  273.                         val = Left(val,50) & "..."
  274.                     end if
  275.                 end if
  276.                 if fieldsize < 15 then
  277.                     textstr=disableintstart & "<FONT FACE='" & Session("FONTFACE") & "' SIZE='" & Session("FONTPOINT") & "'>"& val  & "</FONT>" & disabletextend            
  278.                 else
  279.                     textstr=disabletextstart & "<FONT FACE='" & Session("FONTFACE") & "' SIZE='" & Session("FONTPOINT") & "'>"& val  & "</FONT>" & disabletextend
  280.                 end if
  281.             end if
  282.         end if            
  283.     end if
  284.     writeinputbox=textstr
  285.     
  286. end function
  287.  
  288. function writeSelect(selName, size, onChange, isMultiSel)
  289.     dim textstr
  290.     textstr = "<SELECT NAME='" & selName & "'"
  291.     if size <> "" then    
  292.         textstr = textstr & " Size='" & size & "'"        
  293.     end if
  294.     if onChange <> "" then
  295.         textstr = textstr & " OnChange='" & onChange & "'"    
  296.     end if
  297.     if isMultiSel then
  298.         textstr = textstr & " MULTIPLE"
  299.     end if
  300.     if Session("hasStyles") then 
  301.             textstr=textstr & Session("DEFINPUTSTYLE")
  302.     end if 
  303.     textstr = textstr & ">"
  304.     
  305.     writeSelect = textstr
  306.     
  307. end function
  308.  
  309. function minVal(thisval, min)
  310.     if thisval < min then
  311.         thisval = min
  312.     end if
  313.     minVal = thisval
  314. end function
  315.  
  316. Sub alertuser(fieldname)
  317.     'Response.Write "<SCRIPT>alert(" & quote & "Could not retrieve a value for " & fieldname & ". (" & err & ":" & err.description & ")" & quote & ");</SCRIPT>"
  318.     Response.Write "<FONT COLOR=red><B>*</B></FONT>"
  319. End Sub
  320.  
  321.  %>
  322.